﻿using System;
using System.Collections.Generic;
using System.Text;

namespace RaisingStudio.Data.Common
{
    /// <summary>
    /// datatable Relation definition.
    /// </summary>
    [Serializable]
    public class DataRelationDefinition
    {
        private string relationName;
        /// <summary>
        /// datatable Relation name.
        /// </summary>
        public string RelationName
        {
            get 
            {
                return this.relationName;
            }
            set
            {
                this.relationName = value;
            }
        }

        private string parentTable;
        /// <summary>
        /// parent table name.
        /// </summary>
        public string ParentTable
        {
            get 
            {
                return this.parentTable;
            }
            set
            {
                this.parentTable = value;
            }
        }

        private string[] parentColumns;
        /// <summary>
        /// parent An array of table names.
        /// </summary>
        public string[] ParentColumns
        {
            get 
            {
                return this.parentColumns;
            }
            set
            {
                this.parentColumns = value;
            }
        }

        private string childTable;
        /// <summary>
        /// child table name.
        /// </summary>
        public string ChildTable
        {
            get 
            {
                return this.childTable;
            }
            set
            {
                this.childTable = value;
            }
        }

        private string[] childColumns;
        /// <summary>
        /// child An array of table names.
        /// </summary>
        public string[] ChildColumns
        {
            get
            {
                return this.childColumns;
            }
            set
            {
                this.childColumns = value;
            }
        }

        private bool constraint = false;
        /// <summary>
        /// constraint Relation 。
        /// </summary>
        public bool Constraint
        {
            get 
            {
                return this.constraint;
            }
            set
            {
                this.constraint = value;
            }
        }
             
        #region Constructor
        /// <summary>
        /// Constructor
        /// </summary>
        public DataRelationDefinition()
        {
        }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="relationName">datatable Relation name.</param>
        /// <param name="parentTable">parent table name.</param>
        /// <param name="parentColumns">parent An array of table names.</param>
        /// <param name="childTable">child table name.</param>
        /// <param name="childColumns">child An array of table names.</param>
        public DataRelationDefinition(string relationName, string parentTable, string[] parentColumns, string childTable, string[] childColumns)
        {
            this.relationName = relationName;
            this.parentTable = parentTable;
            this.parentColumns = parentColumns;
            this.childTable = childTable;
            this.childColumns = childColumns;
        }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="relationName">datatable Relation name.</param>
        /// <param name="parentTable">parent table name.</param>
        /// <param name="parentColumns">parent An array of table names.</param>
        /// <param name="childTable">child table name.</param>
        /// <param name="childColumns">child An array of table names.</param>
        public DataRelationDefinition(string relationName, string parentTable, string[] parentColumns, string childTable, string[] childColumns, bool constraint)
        {
            this.relationName = relationName;
            this.parentTable = parentTable;
            this.parentColumns = parentColumns;
            this.childTable = childTable;
            this.childColumns = childColumns;
            this.constraint = constraint;
        }
        #endregion
    }
}
